
<!DOCTYPE html>
<html lang="zh-CN" class="loading">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>linux 常用命令 - 初一蛙鸣</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="Fechin,"> 
    <meta name="description" content="初一蛙鸣-前端-小程序-vue-react,几个常用的命令生成公钥1ssh-keygen

上传公钥到服务器1ssh-copy-id -i ~&amp;#x2F;.ssh&amp;#x2F;id_rsa.pub 用户名@主机名

SCP 上传文件夹示例1sc,"> 
    
    <link rel="alternative" href="atom.xml" title="初一蛙鸣" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    
    
    
    <meta name="twitter:card" content="summary"/>
    <meta name="twitter:title" content="linux 常用命令 - 初一蛙鸣"/>
    <meta name="twitter:description" content="初一蛙鸣-前端-小程序-vue-react,几个常用的命令生成公钥1ssh-keygen

上传公钥到服务器1ssh-copy-id -i ~&amp;#x2F;.ssh&amp;#x2F;id_rsa.pub 用户名@主机名

SCP 上传文件夹示例1sc,"/>
    
    
    
    
    <meta property="og:site_name" content="初一蛙鸣"/>
    <meta property="og:type" content="object"/>
    <meta property="og:title" content="linux 常用命令 - 初一蛙鸣"/>
    <meta property="og:description" content="初一蛙鸣-前端-小程序-vue-react,几个常用的命令生成公钥1ssh-keygen

上传公钥到服务器1ssh-copy-id -i ~&amp;#x2F;.ssh&amp;#x2F;id_rsa.pub 用户名@主机名

SCP 上传文件夹示例1sc,"/>
    
<link rel="stylesheet" href="/css/diaspora.css">

    <script>window.searchDbPath = "/search.xml";</script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap" rel="stylesheet">
<meta name="generator" content="Hexo 4.2.1"></head>

<body class="loading">
    <span id="config-title" style="display:none">初一蛙鸣</span>
    <div id="loader"></div>
    <div id="single">
    <div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <a class="iconfont icon-home image-icon" href="javascript:;" data-url="https://lhl946.gitee.io"></a>
    <div title="播放/暂停" class="iconfont icon-play"></div>
    <h3 class="subtitle">linux 常用命令</h3>
    <div class="social">
        <div>
            <div class="share">
                <a title="获取二维码" class="iconfont icon-scan" href="javascript:;"></a>
            </div>
            <div id="qr"></div>
        </div>
    </div>
    <div class="scrollbar"></div>
</div>

    <div class="section">
        <div class="article">
    <div class='main'>
        <h1 class="title">linux 常用命令</h1>
        <div class="stuff">
            <span>三月 26, 2024</span>
            
  <ul class="post-tags-list" itemprop="keywords"><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/linux/" rel="tag">linux</a></li><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/%E5%AE%B9%E5%99%A8/" rel="tag">容器</a></li><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/%E9%83%A8%E7%BD%B2/" rel="tag">部署</a></li></ul>


        </div>
        <div class="content markdown">
            <h4 id="几个常用的命令"><a href="#几个常用的命令" class="headerlink" title="几个常用的命令"></a>几个常用的命令</h4><h6 id="生成公钥"><a href="#生成公钥" class="headerlink" title="生成公钥"></a>生成公钥</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen</span><br></pre></td></tr></table></figure>

<h6 id="上传公钥到服务器"><a href="#上传公钥到服务器" class="headerlink" title="上传公钥到服务器"></a>上传公钥到服务器</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-copy-id -i ~&#x2F;.ssh&#x2F;id_rsa.pub 用户名@主机名</span><br></pre></td></tr></table></figure>

<h6 id="SCP-上传文件夹示例"><a href="#SCP-上传文件夹示例" class="headerlink" title="SCP 上传文件夹示例"></a>SCP 上传文件夹示例</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">scp -r -P 22 .&#x2F;dist&#x2F;* bingli@139.199.182.28:&#x2F;home&#x2F;bingli&#x2F;code&#x2F;deploy&#x2F;all-assert&#x2F;report_distribute&#x2F;</span><br></pre></td></tr></table></figure>

<h6 id="安装微软开发套件"><a href="#安装微软开发套件" class="headerlink" title="安装微软开发套件"></a>安装微软开发套件</h6><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --global --production windows-build-tools</span><br></pre></td></tr></table></figure>

<h6 id="ssh-隧道-端口转发"><a href="#ssh-隧道-端口转发" class="headerlink" title="ssh 隧道-端口转发"></a>ssh 隧道-端口转发</h6><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh -p 2789 -L 3306:localhost:3306  bingli@101.33.225.202</span><br></pre></td></tr></table></figure>

<h6 id="设置代理"><a href="#设置代理" class="headerlink" title="设置代理"></a>设置代理</h6><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">export http_proxy=http://192.168.1.90:7890</span><br><span class="line">export https_proxy=http://192.168.1.90:7890</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">取消</span></span><br><span class="line">unset http_proxy</span><br><span class="line">unset https_proxy</span><br></pre></td></tr></table></figure>

<h6 id="解压-asar"><a href="#解压-asar" class="headerlink" title="解压 asar"></a>解压 asar</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">asar extract app.asar .&#x2F;myapp</span><br></pre></td></tr></table></figure>

<h6 id="端口占用"><a href="#端口占用" class="headerlink" title="端口占用"></a>端口占用</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">lsof -i tcp:8888</span><br></pre></td></tr></table></figure>

<h6 id="查看-xxx-的运行情况"><a href="#查看-xxx-的运行情况" class="headerlink" title="查看 xxx 的运行情况"></a>查看 xxx 的运行情况</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">ps aux | grep xxx</span><br><span class="line">netstat -tuln | grep 8080</span><br><span class="line"></span><br><span class="line">OLLAMA_HOST&#x3D;0.0.0.0:8080 ollama serve</span><br></pre></td></tr></table></figure>

<h6 id="syetemctl"><a href="#syetemctl" class="headerlink" title="syetemctl"></a>syetemctl</h6><p>​ 在 Linux 系统中，/lib/systemd/system 目录是 systemd 服务管理系统的主要配置文件目录。这个目录下存储了各种服务的 .service 文件，这些文件定义了服务的启动参数。<br>每一个 .service 文件都对应一个服务，文件里面包含了服务的描述、运行的命令、依赖关系等各种信息。<br>​ 当我们使用 systemctl enable [服务名称] 命令设置一个服务开机自启动时，系统会在 /etc/systemd/system 目录下创建一个到 /lib/systemd/system/[服务名称].service 的符号链接。<br>​ 这样，无论你是要启动、停止、还是自启动一个服务，systemd 都会根据 /lib/systemd/system 目录下的对应 .service 文件来操作。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">systemctl start [服务名称]：启动一个服务。例如：systemctl start jenkins。</span><br><span class="line">systemctl stop [服务名称]：停止一个服务。例如：systemctl stop jenkins。</span><br><span class="line">systemctl restart [服务名称]：重启一个服务。例如：systemctl restart jenkins。</span><br><span class="line">systemctl reload [服务名称]：如果服务支持，可以使用此命令重新加载服务的配置文件，而无需重启服务。</span><br><span class="line">systemctl status [服务名称]：查看一个服务的状态。例如：systemctl status jenkins。</span><br><span class="line">systemctl enable [服务名称]：设置一个服务开机自启动。例如：systemctl enable jenkins。</span><br><span class="line">systemctl disable [服务名称]：关闭一个服务的开机自启动。例如：systemctl disable jenkins。</span><br><span class="line">systemctl list-units --type&#x3D;service --all：列出所有的服务单元。</span><br><span class="line">systemctl reboot：重新启动系统。</span><br><span class="line">systemctl poweroff：关闭系统。</span><br></pre></td></tr></table></figure>

            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="false">
                <source type="audio/mpeg" src="">
            </audio>
            
                <ul id="audio-list" style="display:none">
                    
                        
                            <li title="0" data-url="http://link.hhtjim.com/163/425570952.mp3"></li>
                        
                    
                        
                            <li title="1" data-url="http://link.hhtjim.com/163/425570952.mp3"></li>
                        
                    
                </ul>
            
        </div>
        
        
    <div id="gitalk-container" class="comment link"
		data-enable="false"
        data-ae="false"
        data-ci=""
        data-cs=""
        data-r=""
        data-o=""
        data-a=""
        data-d="false"
    >查看评论</div>


    </div>
    
</div>


    </div>
</div>
</body>


<script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/typed.js"></script>
<script src="/js/diaspora.js"></script>


<link rel="stylesheet" href="/photoswipe/photoswipe.css">
<link rel="stylesheet" href="/photoswipe/default-skin/default-skin.css">


<script src="/photoswipe/photoswipe.min.js"></script>
<script src="/photoswipe/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>






</html>
